package com.itcast.www.im.ws;

import java.util.ArrayList;
import java.util.List;

public class Message {
    //type： online  login  offline
    String type;
    String loginName;
    String loginPass;
    String fromName;
    String toName;
    String content;
    List<String> onLines;
    String offName;

    /**
     * 快速构造一个下线消息
     * @param offName
     * @return
     */
    public static Message getOffline(String offName){
        Message m = new Message();
        m.setType("offline");
        m.setOffName(offName);
        return m;
    }

    /**
     * 快速构造上线消息
     * @param list
     * @return
     */
    public static Message getOnline(List<String> list){
        Message m = new Message();
        m.setType("online");
        m.setOnLines(list);
        return m;
    }

    public static Message getOnline(String name){
        List<String> list = new ArrayList<>();
        list.add(name);

        Message m = new Message();
        m.setType("online");
        m.setOnLines(list);
        return m;
    }


    public String getOffName() {
        return offName;
    }

    public void setOffName(String offName) {
        this.offName = offName;
    }

    public List<String> getOnLines() {
        return onLines;
    }

    public void setOnLines(List<String> onLines) {
        this.onLines = onLines;
    }

    public String getFromName() {
        return fromName;
    }

    public void setFromName(String fromName) {
        this.fromName = fromName;
    }

    public String getToName() {
        return toName;
    }

    public void setToName(String toName) {
        this.toName = toName;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getLoginPass() {
        return loginPass;
    }

    public void setLoginPass(String loginPass) {
        this.loginPass = loginPass;
    }
}
